<?php
$profileId=$_SESSION['profileid'];
?>
<div class = "row" >
<?php
$PPParams = array(
      'dimensions' => 'ga:pageTitle',
      
      
      'max-results' => '25');
$resultsPP = $analytics->data_ga->get(
       'ga:' . $profileId,
       '2014-12-12',
       '2014-12-12',
	   'ga:pageviews',
       $PPParams
	   );
	   
?>
<script type="text/javascript">
            var chartData1 = [
		<?php
    // Print table rows.
		$x=1;
		foreach ($resultsPP->getRows() as $row) {
      
		?>
		{
			"pagePath": "<?php echo $row[0]; ?>",
			"pageView": <?php echo $row[1]+80; ?>
		}
		<?php
		if($x>=sizeof($resultsPP->getRows()))
		{
		?>
		<?php
		}
		else
		{
		?>
		,
		<?php
		}
		$x++;

     
		}
		?>
		];
</script>
</div>

<script src="amcharts/amcharts.js" type="text/javascript"></script>
        <script src="amcharts/serial.js" type="text/javascript"></script>

<script type="text/javascript">
            var charta;

            AmCharts.ready(function () {
                // SERIAL CHART
                charta = new AmCharts.AmSerialChart();
                charta.dataProvider = chartData1;
                charta.categoryField = "pagePath";
                charta.startDuration = 1;

                // AXES
                // category
                var categoryAxisa = charta.categoryAxis;
                categoryAxisa.labelRotation = 90;
                categoryAxisa.gridPosition = "start";

                // value
                // in case you don't want to change default settings of value axis,
                // you don't need to create it, as one value axis is created automatically.

                // GRAPH
                var grapha = new AmCharts.AmGraph();
                grapha.valueField = "pageView";
                grapha.balloonText = "[[category]]: <b>[[value]]</b>";
                grapha.type = "column";
                grapha.lineAlpha = 0;
                grapha.fillAlphas = 0.8;
                charta.addGraph(grapha);

                // CURSOR
                var chartCursora = new AmCharts.ChartCursor();
                chartCursora.cursorAlpha = 0;
                chartCursora.zoomable = false;
                chartCursora.categoryBalloonEnabled = false;
                charta.addChartCursor(chartCursora);

                charta.creditsPosition = "top-right";

                charta.write("charta");
            });
</script>

<div class = "row" >

<div id="charta" style="width: 100% ; height: 800px;"></div>
</div>